export interface createLifeCycleParams {
  id?: string;
  /**
   * 画布布局
   */
  layout?: string;
  /**
   * 规则模型
   */
  model?: {
    nodes?: lifecycleNode[];
    edges?: lifecycleEdge[];
  };
  /**
   * 名称
   */
  name?: any;
  /**
   * 描述
   */
  remark?: string;
  /**
   * 状态
   */
  status: lifecycleStatus;
  /**
   * 状态卡片
   */
  statusCard?: string;
  /**
   * 类型
   */
  type: lifecycleType;
}

/**
 * 状态
 */
export enum lifecycleStatus {
  Disable = "DISABLE",
  Normal = "NORMAL",
}

/**
 * 类型
 */
export enum lifecycleType {
  DataFlow = "DATA_FLOW",
  Project = "PROJECT",
  Task = "TASK",
}

export interface LifeCycleEntity {
  deleted?: string;
  id: string;
  /**
   * 布局
   */
  layout?: string;
  /**
   * 规则模型json
   */
  model?: {
    nodes?: lifecycleNode[];
    edges?: lifecycleEdge[];
  };
  /**
   * 生命周期名
   */
  name?: string;
  /**
   * 描述
   */
  remark?: string;
  /**
   * 状态
   */
  status: lifecycleStatus;
  /**
   * 节点卡片
   */
  statusCard?: string;
  /**
   * 类型
   */
  type: lifecycleType;

  [property: string]: any;
}

/**
 * queryPagesType
 */
export interface queryPagesType {
  allFields?: string[];
  conditions: QueryCondition[];
  logic?: string;
  pageNo?: number;
  pageSize?: number;
  sortParams?: SortParam[];

  [property: string]: any;
}

/**
 * QueryCondition
 */
export interface QueryCondition {
  field: string;
  operator?: string;
  value: any;

  [property: string]: any;
}

/**
 * SortParam
 */
export interface SortParam {
  asc?: boolean;
  field?: string;

  [property: string]: any;
}

export interface PageResultType<T> {
  pageNo: number;
  pageSize: number;
  result?: T[];
  total: number;

  [property: string]: any;
}

/**
 * lifecycle status
 */

/**
 * 生命周期全局状态
 */
export interface LifeGlobalStatus {
  /**
   * 颜色
   */
  color: string;
  /**
   * 图标
   */
  icon: string;
  id: string;
  /**
   * 名成
   */
  name?: { [key: string]: any };
  /**
   * 状态
   */
  code?: {
    code?: string;
    name?: { [key: string]: any };
  };
  /**
   * 可用
   */
  status?: string;
  [property: string]: any;
}

export interface fieldsListResponse {
  code?: number;
  data: Datum[];
  message?: string;

  [property: string]: any;
}

export interface Datum {
  code: string;
  name: string;
  values: Value[];

  [property: string]: any;
}

/**
 * 选项
 */
export interface Value {
  code: string;
  displayName: string;

  [property: string]: any;
}

export interface lifecycleNode {
  id?: string;
  name?: { [key: string]: any } | string;
  // 审核中
  isAuditing?: boolean;
  // 成熟度
  progress?: number;
  // 映射码
  code?: string;
  color?: string;
}

export interface lifecycleEdge {
  id?: string;
  fromNodeId?: string;
  toNodeId?: string;
  name?: { [key: string]: any };
  buttonName?: { [key: string]: any };
  remark?: string;
  tag?: string;
  auditId?: string;
  transferRules?: object[];
  permissionRule?: object;
}

export interface saveLifecycleNodeParams {
  id?: string;
  node: lifecycleNode;
}

export interface saveLifecycleEdgeParams {
  id?: string;
  edge: lifecycleEdge;
}
